import request from '@/utils/request'

// 查询题库列表
export function listQuestion_bank(query) {
    return request({
        url: '/ex/question_bank/list',
        method: 'get',
        params: query
    })
}

// 查询考试题库列表
export function listQuestion_bank_ex(query) {
  return request({
    url: '/ex/question_bank/list-ex',
    method: 'get',
    params: query
  })
}


// 查询可报名的题库
export function question_apply(query) {
  return request({
    url: '/ex/question_bank/apply',
    method: 'get'
  })
}

// 查询题库详细
export function getQuestion_bank(id) {
    return request({
        url: '/ex/question_bank/' + id,
        method: 'get'
    })
}

export function all_question(id) {
    return request({
        url: '/ex/question_bank/all-question/' + id,
        method: 'get'
    })
}

// 新增题库
export function addQuestion_bank(data) {
    return request({
        url: '/ex/question_bank',
        method: 'post',
        data: data
    })
}

// 修改题库
export function updateQuestion_bank(data) {
    return request({
        url: '/ex/question_bank',
        method: 'put',
        data: data
    })
}

// 删除题库
export function delQuestion_bank(id) {
    return request({
        url: '/ex/question_bank/' + id,
        method: 'delete'
    })
}


// 查询当前机构的可报名考题
export function apply() {
  return request({
    url: '/ex/question_bank/apply',
    method: 'get'
  })
}

//保存已作答答案
export function save_answers(bankId,answers){
  return request({
    url: '/ex/question_bank/save-answers/'+ bankId,
    method: 'post',
    data: answers
  })
}


//获取已作答答案
export function get_answers(bankId){
  return request({
    url: '/ex/question_bank/get-answers/'+ bankId,
    method: 'get'
  })
}

//发送短信-人数
export function smsSend_people_count(classIds,trainFlag){
  return request({
    url: '/ex/question_bank/smsSend-people-count',
    data: {classIds: classIds,trainFlag: trainFlag},
    method: 'post'
  })
}

//发送短信
export function smsSend(id,classIds,trainFlag){
  return request({
    url: '/ex/question_bank/smsSend/'+ id,
    data: {classIds: classIds,trainFlag: trainFlag},
    method: 'post'
  })
}
